package com.peenongsaban.freelance.action;

import com.opensymphony.xwork2.ActionSupport;
import com.peenongsaban.freelance.model.PostServiceModel;
import com.peenongsaban.freelance.service.PostServiceService;

public class PostServiceAction extends ActionSupport {
	
	private static final long serialVersionUID = 1L;
	
	PostServiceModel model = new PostServiceModel();

	public PostServiceModel getModel() {
		return model;
	}

	public void setModel(PostServiceModel model) {
		this.model = model;
	}

	public String showPostServicePage(){
		PostServiceService service = new PostServiceService();
		model.setListAptitudeType(service.getListAptitudeType());
		model.setListServiceLastUpdate(service.getListServiceLastUpdate());
		return SUCCESS;
	}
	
	public String postService(){
		PostServiceService service = new PostServiceService();		
		if(service.isAddPostService(model)){
			return SUCCESS;
		}else{
			model.setPostService(model.getPostService()); 
		}		
		return ERROR;		
	}
}
